﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MyPanel.Properties;

namespace MyPanel
{
    public partial class MyPanel : UserControl
    {
        public MyPanel()
        {
            InitializeComponent();
        }
        protected bool isEnter = false;
        protected Image full = Properties.Resources.full;
        protected Image side = Properties.Resources.side;

        private void myButton1_MouseEnter(object sender, EventArgs e)
        {
            button.NormalImage.RotateFlip(RotateFlipType.Rotate180FlipY);
            button.FousedImage.RotateFlip(RotateFlipType.Rotate180FlipY);
            button.MouseDownImage.RotateFlip(RotateFlipType.Rotate180FlipY);

            isEnter = true;  
            Invalidate();
            
        }

        private void myButton1_MouseLeave(object sender, EventArgs e)
        {
            button.NormalImage.RotateFlip(RotateFlipType.Rotate180FlipY);
            button.FousedImage.RotateFlip(RotateFlipType.Rotate180FlipY);
            button.MouseDownImage.RotateFlip(RotateFlipType.Rotate180FlipY);

            isEnter = false; 
            Invalidate();
        }

        private void MyPanel_MouseEnter(object sender, EventArgs e)
        {
            
        }

        private void MyPanel_MouseLeave(object sender, EventArgs e)
        {

        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (isEnter)
            {
                e.Graphics.DrawImage(full, 0, 0, full.Width, full.Height);
                Console.WriteLine("onpaint isEnter 11111");
            }
            else
            {
                e.Graphics.DrawImage(side,0,0,side.Width,side.Height);
                Console.WriteLine("onpaint isNOTEnter 11111");
            }

        }

    }
}
